﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Site.master" Inherits="OnlyAuthenticated_Statistici" CodeBehind="Statistici.aspx.cs" %>


<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div class="panel" style="div.panel">
    </div>
    <h2>Statistici
    </h2>
    <br />
    <h3>Selecteaza Userul:</h3>

    <asp:DropDownList ID="DropDownListUsers" runat="server" DataSourceID="UserSqlDataSource"
        DataTextField="UserName" DataValueField="UserName" AutoPostBack="True">
    </asp:DropDownList>
    <asp:SqlDataSource ID="UserSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
        SelectCommand="SELECT [UserId], [UserName] FROM [vw_aspnet_Users] ORDER BY [UserName]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSourceForManagers" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
        SelectCommand="SELECT [Abreviere], [TextAbreviere], [Specialitate], [Bold], [Italic], [MarimeText], [Gen], [UserEditor], [ID] FROM [Abrevieri] WHERE ([UserEditor] = @UserName) ORDER BY [Abreviere]"
        DeleteCommand="DELETE FROM [Abrevieri] WHERE [ID] = @ID"
        InsertCommand="INSERT INTO [Abrevieri] ([Abreviere], [TextAbreviere], [Specialitate], [Bold], [Italic], [MarimeText], [Gen], [UserEditor]) VALUES (@Abreviere, @TextAbreviere, @Specialitate, @Bold, @Italic, @MarimeText, @Gen, @UserEditor)"
        UpdateCommand="UPDATE [Abrevieri] SET [Abreviere] = @Abreviere, [TextAbreviere] = @TextAbreviere, [Specialitate] = @Specialitate, [Bold] = @Bold, [Italic] = @Italic, [MarimeText] = @MarimeText, [Gen] = @Gen, [UserEditor] = @UserEditor WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Abreviere" Type="String" />
            <asp:Parameter Name="TextAbreviere" Type="String" />
            <asp:Parameter Name="Specialitate" Type="String" />
            <asp:Parameter Name="Bold" Type="Boolean" />
            <asp:Parameter Name="Italic" Type="Boolean" />
            <asp:Parameter Name="MarimeText" Type="Int32" />
            <asp:Parameter Name="Gen" Type="String" />
            <asp:Parameter Name="UserEditor" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownListUsers" Name="UserName" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Abreviere" Type="String" />
            <asp:Parameter Name="TextAbreviere" Type="String" />
            <asp:Parameter Name="Specialitate" Type="String" />
            <asp:Parameter Name="Bold" Type="Boolean" />
            <asp:Parameter Name="Italic" Type="Boolean" />
            <asp:Parameter Name="MarimeText" Type="Int32" />
            <asp:Parameter Name="Gen" Type="String" />
            <asp:Parameter Name="UserEditor" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <br />
    <br />
    <br />
    <asp:Label ID="Label2" runat="server" Text="Modelele introduse de user:"></asp:Label>
    <br />
    <asp:GridView ID="GridView2" runat="server" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID"
        DataSourceID="ModeleSqlDataSource">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False"
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="NumeModel" HeaderText="NumeModel"
                SortExpression="NumeModel" />
            <asp:BoundField DataField="Specialitate" HeaderText="Specialitate"
                SortExpression="Specialitate" />
            <asp:BoundField DataField="UserEditor" HeaderText="UserEditor"
                SortExpression="UserEditor" />
            <asp:CommandField DeleteText="Sterge" ShowDeleteButton="True"
                ShowEditButton="True" UpdateText="OK" />
        </Columns>
    </asp:GridView>

    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />

    <asp:Label ID="Label1" runat="server" Text="Abrevierile adaugate de user:"></asp:Label><br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSourceForManagers"
        Style="margin-top: 0px" Width="98%">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                SortExpression="ID">
                <ControlStyle Width="20px" />
            </asp:BoundField>
            <asp:BoundField DataField="Abreviere" HeaderText="Abreviere" SortExpression="Abreviere">
                <ControlStyle Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="TextAbreviere" HeaderText="TextAbreviere" SortExpression="TextAbreviere">
                <ControlStyle Width="300px" />
            </asp:BoundField>
            <asp:BoundField DataField="Specialitate" HeaderText="Specialitate" SortExpression="Specialitate">
                <ControlStyle Width="110px" />
            </asp:BoundField>
            <asp:CheckBoxField DataField="Bold" HeaderText="B" SortExpression="Bold">
                <ControlStyle Width="98%" />
                <ItemStyle Width="10px" />
            </asp:CheckBoxField>
            <asp:CheckBoxField DataField="Italic" HeaderText="i" SortExpression="Italic">
                <ControlStyle Width="98%" />
                <ItemStyle Width="10px" />
                <HeaderStyle Font-Italic="True" />
            </asp:CheckBoxField>
            <asp:BoundField DataField="MarimeText" HeaderText="Txt" SortExpression="MarimeText">
                <ControlStyle Width="98%" />
                <ItemStyle Width="15px" />
            </asp:BoundField>
            <asp:BoundField DataField="Gen" HeaderText="Gen" SortExpression="Gen">
                <ControlStyle Width="98%" />
                <ItemStyle Width="60px" />
            </asp:BoundField>
            <asp:BoundField DataField="UserEditor" HeaderText="UserEditor" SortExpression="UserEditor">
                <ControlStyle Width="70px" />
            </asp:BoundField>
            <asp:CommandField DeleteText="Sterge" ShowDeleteButton="True" ShowEditButton="True"
                UpdateText="OK">
                <ControlStyle Width="25px" />
            </asp:CommandField>
        </Columns>
    </asp:GridView>
    <br />
    <br />
    <br />

    <asp:SqlDataSource ID="ModeleSqlDataSource" runat="server"
        ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
        DeleteCommand="DELETE FROM [DenumiriModele] WHERE [ID] = @ID"
        InsertCommand="INSERT INTO [DenumiriModele] ([NumeModel], [TextModel], [Specialitate], [UserEditor]) VALUES (@NumeModel, @TextModel, @Specialitate, @UserEditor)"
        SelectCommand="SELECT [ID], [NumeModel], [TextModel], [Specialitate], [UserEditor] FROM [DenumiriModele] WHERE ([UserEditor] = @UserEditor) ORDER BY [NumeModel]"
        UpdateCommand="UPDATE [DenumiriModele] SET [NumeModel] = @NumeModel, [TextModel] = @TextModel, [Specialitate] = @Specialitate, [UserEditor] = @UserEditor WHERE [ID] = @ID">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="NumeModel" Type="String" />
            <asp:Parameter Name="TextModel" Type="String" />
            <asp:Parameter Name="Specialitate" Type="String" />
            <asp:Parameter Name="UserEditor" Type="String" />
        </InsertParameters>
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownListUsers" Name="UserEditor"
                PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="NumeModel" Type="String" />
            <asp:Parameter Name="TextModel" Type="String" />
            <asp:Parameter Name="Specialitate" Type="String" />
            <asp:Parameter Name="UserEditor" Type="String" />
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

</asp:Content>



